package com.ecp.pay.online.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.ecp.commons.db.GenericServiceImpl;
import com.ecp.pay.online.bean.WangyinBank;

@Repository("wangyinBankService")
public class WangyinBankServiceImpl extends GenericServiceImpl<WangyinBank> implements WangyinBankService {

	@Override
	public List<WangyinBank> getBanksByTypeId(int typeId) throws Exception {
		return this.getEntityList(new String[]{"typeId"}, new Object[]{typeId}, null);
	}

	@Override
	public WangyinBank getBankByCode(String code) throws Exception {
		return this.getEntity(new String[]{"code"}, new Object[]{code});
	}
	
	@Override
	public Map<String, List<WangyinBank>> getBankMap() throws Exception {
			Map<String, List<WangyinBank>> bankMap = new HashMap<String, List<WangyinBank>>();
			bankMap.put("jieji", this.getBanksByTypeId(WangyinBank.TYPE_JIEJI));
			bankMap.put("xinyong", this.getBanksByTypeId(WangyinBank.TYPE_XINYONG));
			return bankMap;
	}
	
}
